<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
</head>
<body>
    <div class="easyui-panel"  style="padding:100px;height:100%">
        <form id="user-pwd-form" method="post" style="width:400px;margin:0 auto">
            <div style="margin-bottom:20px">
                <input class="easyui-passwordbox" id="password" name="password" style="width:100%" data-options="label:'原始密码:',required:true">
            </div>
            <div style="margin-bottom:20px">
                <input class="easyui-passwordbox" id="upassword" name="upassword" style="width:100%" data-options="label:'新设置密码:',required:true">
            </div>
            <div style="margin-bottom:20px">
                <input class="easyui-passwordbox" id="rupassword" name="rupassword" style="width:100%" data-options="label:'确认新密码:',required:true" validType="equals['#upassword']">
            </div>
           <div style="text-align:center;padding:5px 0">
            <a href="javascript:void(0)" class="easyui-linkbutton" onclick="submitForm()" style="width:80px">保存</a>
           
        </div>
        </form>
        

           <script>
        
	        function submitForm(){
	            $.messager.progress();
	            $('#user-pwd-form').form('submit',{
	                url:'${Domain}api/user/resetpwd',
	                onSubmit: function(param){
	                   
	                   var isValid = $(this).form('validate');
						if (!isValid){
							$.messager.progress('close');	// 如果表单是无效的则隐藏进度条
							return false;
						}
						password=$('#password').textbox('getValue');
						upassword=$('#upassword').textbox('getValue');
						rupassword=$('#rupassword').textbox('getValue');
						if(upassword!=rupassword){
							$.messager.alert('提示','两次密码不正确！','error');
							$.messager.progress('close');						
							return false;
						}			  	  		  
				    
				    },
				   success:function(data){
					    var json = eval('(' + data + ')');  // change the JSON string to javascript object
					     if (json.status){
					           $.messager.show({
					                title:'修改提示',
					                msg:json.msg,
					                timeout:2000,
					                showType:'slide'
				            	});				           
					     }else
					     {
					        $.messager.alert('提示',json.msg,'error');
					     }
					     $('#password').textbox('setValue','');	
						$('#upassword').textbox('setValue','');	
						$('#rupassword').textbox('setValue','');
					     $.messager.progress('close');
					}
	            });
	        }
	        
	    </script>
    </div>


</body>
</html>